import React, { useState, useEffect } from "react";
import { useLocation, useNavigate } from "react-router-dom";
import { ArrowLeft } from "@react-vant/icons";
import { Collapse } from "react-vant";
type Props = {};

const Seat = (props: Props) => {
  const location = useLocation();
  const navigate = useNavigate();
  let [obj,setObj]:any=useState([])
  useEffect(()=>{
  setObj(JSON.parse(localStorage.getItem('shuju')as any))
  },[])
  const dd=()=>{
    navigate('/ofg')
  }
  return (
    <div className="seats">
      <header>
        <span onClick={() => navigate("/querydata")}>
          <ArrowLeft />
        </span>
        <span>{obj.state}</span>
        <span></span>
      </header>
      <main>
        <div className="main_top">
          <div className="main_top_left">
            <p>{obj.start}</p>
            <p>{obj.starttime}</p>
            <p>4月27日</p>
          </div>
          <div className="main_top_centent">
            <p>{obj.state}</p>
            <p>
              --- <span style={{ color: "rgba(1,172,192)" }}>时刻表</span> ---
            </p>
            <p>消耗5时间47分</p>
          </div>
          <div className="main_top_right">
            <p>{obj.end}</p>
            <p>{obj.endtime}</p>
            <p>4月27日</p>
          </div>
        </div>
        <div className="main_box">
          <div>
            <Collapse>
              <Collapse.Item title="二等座" name="1">
                <p>
                  快速预定 400元 <button onClick={dd}>买票</button>
                </p>
                <p>
                  普通预定 400元 <button>买票</button>
                </p>
              </Collapse.Item>
              <Collapse.Item title="一等座" name="2">
                <p>
                  快速预定 600元 <button>买票</button>
                </p>
                <p>
                  普通预定 600元 <button>买票</button>
                </p>
              </Collapse.Item>
              <Collapse.Item title="商务座" name="3">
                <p>
                  快速预定 800元 <button>买票</button>
                </p>
                <p>
                  普通预定 800元 <button>买票</button>
                </p>
              </Collapse.Item>
            </Collapse>
          </div>
        </div>
      </main>
    </div>
  );
};

export default Seat;
